<template>
  <div class="app-container">
    <div class="change">
      <el-divider content-position="left">基本信息</el-divider>
      <p>
        <span>标题：</span>
        <span>{{tempData.titles}}</span>
      </p>
      <p>
        <span>部门名称：</span>
        <span>{{tempData.deparement}}</span>
      </p>
      <p>
        <span>提交人：</span>
        <span>{{tempData.persons}}</span>
      </p>
      <p>
        <span>备注：</span>
        <span>{{tempData.remartks}}</span>
      </p>
    </div>
    <div class="fileup">
      <div class="uping">
        <p>
          <span>资料名</span>
          <span>文档</span>
        </p>
        <p>
          <span>上传资料</span>
          <strong v-if="tempData.parentFile">文档</strong>
          <strong v-if="tempData.parentFile" @click="downLoad(tempData.parentFile)">
            下载
            <i class="el-icon-download" />
          </strong>
        </p>
      </div>
    </div>
    <!-- 落实信息 -->
    <div class="zishebei">
      <el-divider content-position="left">落实信息</el-divider>
      <div class="zd3-btm">
        <el-table
          :data="tableData1"
          border
          style="width: 100%;margin-bottom: 20px;"
          :show-header="true"
          v-loading="loading"
        >
          <el-table-column align="center" prop="ptitles" label="标题" ></el-table-column>
          <el-table-column align="center" prop="parentFile" label="文档">
            <template slot-scope="scope">
              <p @click="downloadFile(scope.row.pfileId)" class="downloadfile">下载<i class="el-icon-download" /></p>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="premarks" label="备注"></el-table-column>
					<el-table-column align="center" prop="ppersons" label="提交人"></el-table-column>
          <!-- <el-table-column align="center" width="250" label="操作">
            <template slot-scope="scope">
              <el-button type="text" size="small" @click="write(scope.row,scope.$index)">修改</el-button>
              <el-popconfirm
                placement="top"
                hideIcon
                title="是否要删除此行？"
                @onConfirm="deleteRow(scope.row)"
              >
                <el-button type="text" size="small" slot="reference">删除</el-button>
              </el-popconfirm>
            </template>
          </el-table-column> -->
        </el-table>
        <el-pagination
          background
          align="right"
          layout="prev, pager, next"
          :total="total1"
          :page-size="50"
          @prev-click="goPrev1"
          @next-click="goNext1"
          @current-change="goPage1"
        />
      </div>
    </div>
    <!-- 进度列表 -->
    <div class="zishebei">
      <el-divider content-position="left">进度完成信息</el-divider>
      <div class="zd3-btm">
        <el-table
          :data="tableData2"
          border
          style="width: 100%;margin-bottom: 20px;"
          :show-header="true"
          v-loading="loading"
        >
          <el-table-column align="center" prop="stitles" label="标题"></el-table-column>
          <el-table-column align="center" prop="scontents" label="内容"></el-table-column>
          <el-table-column align="center" prop="spersons" label="提交人"></el-table-column>
          <el-table-column align="center" prop="parentFile" label="文档">
            <template slot-scope="scope">
              <p @click="downloadFile(scope.row.sfileId)" class="downloadfile">下载<i class="el-icon-download" /></p>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="sremarks" label="备注"></el-table-column>
        </el-table>
        <el-pagination
          background
          align="right"
          layout="prev, pager, next"
          :total="total2"
          :page-size="50"
          @prev-click="goPrev2"
          @next-click="goNext2"
          @current-change="goPage2"
        />
      </div>
    </div>
    <div class="zishebei">
      <el-divider content-position="left">审核记录</el-divider>
      <div class="zd3-btm">
        <el-table
          :data="shenheData"
          border
          style="width: 100%;margin-bottom: 20px;"
          :show-header="true"
          v-loading="loading"
        >
          <el-table-column align="center" prop="content" label="审核人"></el-table-column>
          <el-table-column align="center" prop="evalresult" label="备注"></el-table-column>
          <el-table-column align="center" label="结果">
            <template slot-scope="scope">
                {{scope.row.result == 'true' ? '通过' : '驳回'}}
            </template>
          </el-table-column>
          <el-table-column align="center" prop="insertTime" label="审核时间"></el-table-column>
        </el-table>
      </div>
    </div>
    <!-- 查看审批记录 -->
    <div class="shenpi"></div>
    
    
    <div class="submits">
      <!-- <div class="nosave" @click="nosaveOrder">取消</div> -->
      <div class="save" @click="back">返回</div>
    </div>
  </div>
</template>

<script>
import { getUserFiles } from "@/api/people";
import { getImplement,getProgress,selectShenHe } from '@/api/keyprojects'
export default {
  data() {
    return {
      tempData: {},
      islook: false,
      tableData1: [],
      tableData2: [],
      shenheData: [],
      fileNum: [],
      twoClassify: [],
      writeOradd: 0, //新增0，编辑1
      pages1: 1,
      pages2: 1,
      total1: 1,
      total2: 1,
      loading: false
    };
  },
  mounted() {
    // this.cangkuList();
    console.log(this.$route.params);
    this.tempData = JSON.parse(this.$route.params.options);
    console.log(this.tempData);
    this.getList1(this.tempData.id);
    this.getList2(this.tempData.id);
    this.getshenpi(this.tempData.id)
  },
  methods: {
    downloadFile(filepath) {
      if(filepath){
        window.location.href = filepath;
      }else{
        this.$message({
          message: '暂无上传相关文档',
          type: 'warning'
        })
      }
    },
    // 获取落实信息
    getList1(id) {
      const param = {
        parentId: id,
        currentPage: this.pages1
      }
      getImplement(param).then(res => {
        console.log('重点项目信息模块')
        console.log(res)
        this.tableData1 = res.data.records 
        this.total1 = res.data.total
        this.loading = false
      })
    },
    // 获取进度信息
    getList2(id) {
      const param = {
        parentId: id,
        currentPage: this.pages2
      }
      getProgress(param).then(res => {
        console.log('部门管理')
        console.log(res)
        this.tableData2 = res.data.records
        this.total2 = res.data.total
        this.loading = false
      })
    },
    getshenpi(id){
      selectShenHe({
        prointId: id
      }).then(res => {
        console.log('审批', res)
        this.shenheData = res.data
      })
    },
    // 获取商品文档信息
    getFilesList(id) {
      getUserFiles({ parentId: id }).then(res => {
        console.log(res);
        if (res.data.list.length != 0) {
          this.fileNum = [];
          res.data.list.map(item => {
            this.fileNum.push({
              filename: item.fileDescribe,
              filePath: item.fileName
            });
          });
        }
      });
    },
    goPrev1(page) {
      console.log(page);
      this.pages1--
      this.getList1(this.tempData.id)
    },
    goNext1(page) {
      this.pages1++
      this.getList1(this.tempData.id)
      console.log(page);
    },
    goPage1(page){
      this.pages1 = page
      this.getList1(this.tempData.id)
    },
    goPrev2(page) {
      console.log(page);
      this.pages2--
      this.getList2(this.tempData.id)
    },
    goNext2(page) {
      this.pages2++
      this.getList2(this.tempData.id)
      console.log(page);
    },
    goPage2(page){
      this.pages2 = page
      this.getList2(this.tempData.id)
    },
    downLoad(filepath) {
      window.location.href = filepath;
    },
    nosaveOrder() {
      this.$router.go(-1);
    },
    back() {
      this.$router.go(-1);
    }
  }
};
</script>

<style scoped lang="scss">
/deep/.el-divider {
	background-color: #18A05E;
	position: relative;
}
/deep/.el-divider--horizontal {
    height: 2px;
}
/deep/.el-divider__text {
	color: #18A05E;
}
.ellisp{
	width: 100%;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
	text-align: left;
}
.proimg{
  width: 100px;
  height: 100px;
}
/deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
  background-color: #18a05e !important;
  color: #fff;
}
.zd3-btm /deep/.btn-prev:after {
  content: "上一页";
}
.zd3-btm /deep/.btn-next:before {
  content: "下一页";
}
.zd3-btm /deep/.btn-prev,
.zd3-btm /deep/.btn-next {
  width: 65px !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
}
.shenpi{

}
.downloadfile{
  color: #18a05e;
  cursor: pointer;
}
.zishebei {
  background: #fff;
  padding: 20px;
  border-radius: 0 0 8px 8px;
}
.change {
  display: flex;
  flex-wrap: wrap;
  background: #fff;
  border-radius: 8px 8px 0 0;
  padding: 20px;
  > p {
    width: 33%;
    font-size: 14px;
    display: flex;
    align-items: center;
    color: #333;
    /deep/.el-input__inner {
      // width: inherit;
      background: none;
      height: 32px;
      // line-height: 32px;
      color: #333;
      border: 1px solid rgba(0, 0, 0, 0.1);
      padding: 0 25px;
    }
    /deep/.el-input__icon {
      line-height: 32px;
    }
    .userselect {
      // max-width: 250px;
      flex: 1;
    }

    > span {
      display: block;
      width: 120px;
      text-align: right;
      padding-right: 15px;
      &:last-child {
        text-align: left;
        color: #888;
        flex: 1;
      }
    }
    > input {
      width: inherit;
      flex: 1;
      height: 32px;
      border-radius: 3px;
      border: 1px solid rgba(0, 0, 0, 0.1);
      padding-left: 10px;
      color: #333;
    }
  }
}
.submits {
  display: flex;
  padding: 15px 20px;
  background: #fff;
  margin-top: 20px;
  border-radius: 8px;
  justify-content: flex-end;
  align-items: center;
  > div {
    width: 80px;
    height: 32px;
    text-align: center;
    line-height: 32px;
    color: #fff;
    font-size: 14px;
    border-radius: 4px;
    margin-left: 30px;
    cursor: pointer;
  }
  .add {
    background: #18a05e;
  }
  .save {
    background: #2196f3;
  }
  .nosave {
    background: #999;
  }
}
.fileup {
  position: relative;
  padding: 20px;
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  // align-items: center;
  justify-content: space-between;
  .uping {
    width: 49%;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    border-radius: 5px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
    > p {
      width: 90%;
      font-size: 14px;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      color: #333;
      /deep/.el-input__inner {
        // width: inherit;
        background: none;
        height: 32px;
        // line-height: 32px;
        color: #333;
        border: 1px solid rgba(0, 0, 0, 0.1);
        padding: 0 25px;
      }
      /deep/.el-input__icon {
        line-height: 32px;
      }
      /deep/.el-upload-dragger {
        width: 100%;
        height: 100px;
      }
      /deep/.el-upload-dragger .el-icon-upload {
        font-size: 60px;
        color: #c0c4cc;
        margin: 0;
        line-height: 1;
        width: 100%;
      }
      /deep/.el-upload {
        width: 100%;
      }
      .userselect {
        // max-width: 250px;
        flex: 1;
      }

      > span {
        display: block;
        width: 100px;
        text-align: right;
        padding-right: 15px;
        &:last-child {
          text-align: left;
          color: #888;
        }
      }
      > input {
        width: inherit;
        flex: 1;
        height: 32px;
        border-radius: 3px;
        border: 1px solid rgba(0, 0, 0, 0.1);
        padding-left: 10px;
        color: #333;
      }
      > strong {
        display: inline-block;
        padding-right: 50px;
        font-weight: 100;
        font-size: 14px;
        &:last-child {
          cursor: pointer;
          color: #13ce66;
          font-weight: 600;
        }
      }
      > div {
        width: inherit;
        flex: 1;
      }
    }
  }
}
.zd3-btm {
  background: rgba(255, 255, 255, 1);
  border-radius: 8px;
  // border: 1px solid rgba(0, 0, 0, 0.1);
  margin-top: 20px;
  overflow: hidden;
  &-title {
    display: flex;
    align-items: center;
    height: 70px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: #ffffff;
    > p {
      text-align: center;
      font-size: 16px;
      color: #333;
    }
  }
  .el-pagination {
    white-space: nowrap;
    padding: 15px 5px;
    color: #303133;
    font-weight: bold;
  }
  .addDate {
    margin: 20px 32px 10px 32px;
    height: 32px;
    border-radius: 3px;
    text-align: center;
    line-height: 32px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    border: 1px dashed rgba(0, 0, 0, 0.25);
  }
  .el-button--text {
    margin: 0 15px;
  }
}
</style>
